import myAxios from "./index.js";

export default function getApi(url,requestType,data,headerObj){  // 第一个参数是发接口请求的拼接，第二个参数是请求类型，第三个参数是带给后端的参数，第四个是你想在请求头加的东西（需是对象包裹）
    if(requestType === 'post'){
        return myAxios({
            url: url,
            method: 'post',
            data: data
          },headerObj);
    }else if(requestType === 'get'){
        return myAxios({
            url:url,
            method:'get',
            params:data
        },headerObj)
    }else if(requestType === 'delete'){
        return myAxios({
            url:url,
            method:'delete',
            data:data
        },headerObj)
    }else if(requestType === 'put'){
        return myAxios({
            url:url,
            method:'put',
            data:data
        },headerObj)
    }
}